<?php
				
		$name = "";
		$price = "";
		$manufacture = "";
		$status_price = 1;
		$id_type= -1;
		$id_item = "";
		
		$notification = "";
		
		
		if(isset($_GET['name']))
		{
			$name = $_GET['name'];
		}
		
		
		if(isset($_GET['notification']))
		{
			$notification =constant( $_GET['notification']);
		}
		
		if(isset($_GET['showType']))
		{
			$id_type = $_GET['showType'];
		}
		
		if(isset($_GET['price']))
		{
			$price= $_GET['price'];
		}

		if(isset($_GET['status_price']))
		{
			$status_price = $_GET['status_price'];
		}
		
		if(isset($_GET['id_items']))
		{
			$id_item = $_GET['id_items'];
		}
		
		if(isset ($_GET['manufacture']))
		{
			$manufacture = $_GET['manufacture'];
		}
		
		
		$listStatusPrice = "";
		if($status_price ==1 )
		{
			$listStatusPrice= '<select name="lPrice" id="input4">
										<option value="1" selected="selected"> VND </option>
										<option value="2"> USD </option>
									</select>';
		}
		else
		{
			$listStatusPrice= '<select name="lPrice" id="input4">
							<option value="1" > VND </option>
							<option value="2" selected="selected"> USD </option>
						</select>';

		}
		
		
		//tao list category cho nguoi dung` lua chon
		
		
		
		$type = new CType;
		
		
		$category = new CCategory;
		$arrCategory = $category -> CCategoryList();
		
		$listType='<select name="lTypes" id="input3">';
		if($id_type==-1)
				$listType.='<option selected="selected" value="-1">-- Please choose Type--</option>';
		else
				$listType.='<option value="-1">-- Please choose Type--</option>';	
		
		if(is_array($arrCategory))
		{
			foreach ($arrCategory as $key => $value)
			{
				
				
				$arrType = $type -> CTypeListOfCategory($value['id']);
				if(is_array($arrType))
				{
					//$listType .='<option style="background:#999999" value="-1" <!--title="'.$value['description'].'" -->> Category:'.$value['name'].' </option>';	
					$listType .='<option style="background:#999999" value="-1" > Category:'.$value['name'].' </option>';	
					foreach ($arrType as $key1 => $value1)
					{
						//$listType .='<option value="'.$value1['id'].'" <!--title="'.$value1['description'].'" -->> --- '.$value1['name'].' </option>';
						if($id_type ==$value1['id'] )
							$listType .='<option selected="selected" value="'.$value1['id'].'" > --- '.$value1['name'].' </option>';						
						else
							$listType .='<option value="'.$value1['id'].'" > --- '.$value1['name'].' </option>';							
					}		
				}				
			}
		}		
		
		
		
		
		$listType .='</select>';
		
		
		
		
		
		//ket thuc tao list category 
		$mainContent = '<form action="processItems.php" method="post" name="form1" ENCTYPE="multipart/form-data">
						<div id="content2">
						<script type="text/javascript">
								bkLib.onDomLoaded(function() {
								new nicEditor({maxHeight : 300}).panelInstance("area");
								});
							</script>
						<span style="font-size:10px;color:#FF0000;font-weight:bold;font-family:Arial, Helvetica, sans-serif">'.$notification.'</span>
							<table border="0" width="90%" style="position:relative" align = "center" >
							<tr>
								<td colspan="2" align="left" valign="middle" height="50px"> 
								 <img src="images/profile.png" style="float:left" border="0"/>
								<span class="mystyle1"> Add more Items </span>		 </td>
							</tr>
							<tr>
								<td><span class="mystyle2">Type <span>
								</td>
								<td>'.$listType.'
								</td>
							</tr>
							
							<tr>
								<td><span class="mystyle2">Name <span>
								</td>
								<td>
									<input id="input3" type="text" name="tf_name" value="'.$name.'" >
								</td>
							</tr>
							
							<tr valign="top">
								<td><span class="mystyle2">Price <span>
								</td>
								<td>
									<input id="input3" type="text" name="tf_price" value="'.$price.'" > 
									'.$listStatusPrice.'
								</td>
							</tr>
							
							<tr valign="top">
								<td><span class="mystyle2">Picture <span>
								</td>
								<td>
									<input name="tf_filePicture" type="file" size="47px"/>									
								</td>
							</tr>
							
							
							<tr>
								<td valign="top"><span class="mystyle2">Description <span>
								</td>
								<td>
									<textarea cols="50" rows="6" id="area"  name="tf_description" ></textarea>
								</td>
							</tr>
							
							
							<tr valign="top">
								<td><span class="mystyle2">Manufacture <span>
								</td>
								<td>
									<input name="tf_manufacture" type="text" id="input3" value="'.$manufacture.'"/>									
								</td>
							</tr>
							
							<tr valign="top">
								<td><span class="mystyle2">Item Code<span>
								</td>
								<td>
									<input name="tf_idItem" type="text" id="input3" value="'.$id_item.'"/>									
								</td>
							</tr>
							
							<tr valign="top" style="display:none">
								<td><span class="mystyle2">Thumbnail <span>
								</td>
								<td>
									<input name="tf_fileThumbnail" type="file" size="47px" />									
								</td>
							</tr>
							<tr align="center">
								<td colspan="2" height="50px">
									<input id="input2"  type="submit" name="btn_ok" value="  OK  ">
									<input id="input2" name="btn_cancel" type="submit" value="  Cancel  " >
								</td>
							</tr>
							</table>
						</div>
						
						<input type="hidden" name="hItemAction" value="add">					
						
						</form>';
?>